using System;
using System.Diagnostics;
using System.Drawing;
using System.Net;

namespace Scrobbler
{
    public abstract class StreamSource : IStreamSource
    {
        public Image Logo { get { return null; } }
        public ISong CurrentSong { get; set; }
        public abstract string Name { get; }
        public abstract string Url { get; }

        public event SongEventHandler GotLatestSong;
        public event SongEventHandler SongChanged;
        public event ProcessorEventHandler ErrorOccured;

        public virtual void GetLatestSong()
        {
        }

        public void OnErrorOccured(ProcessorEventArgs args)
        {
            ProcessorEventHandler handler = ErrorOccured;
            if (handler != null) handler(this, args);
        }

        protected void OnGotSong(SongEventArgs args)
        {
            if (GotLatestSong != null) GotLatestSong(this, args);
        }

        protected void OnSongChanged(SongEventArgs args)
        {
            if (SongChanged != null) SongChanged(this, args);
        }

        public override string ToString()
        {
            return Name;
        }
    }
}